<?php
/**
 * beimuaihui System
 * Copyright(c) 2011-2020 beimuaihui.
 * @license    http://www.gnu.org/licenses/gpl.html     This software Under GPL V3 License 
 * beimuaihui@gmail.com
 * http://code.google.com/p/beimuaihui/
 * $Id: Content2.php 262 2011-07-23 15:51:14Z beimuaihui $
 */


Zend_Loader::loadClass("Baogg_Db_Table");

//class Permission extends Baogg_Db_Table {
class Content  extends Baogg_Db_Table {
	/**
	 * The default table name 
	 */
	protected $_name;
	protected $_db ;
	protected $_primary; 
	
	function __construct() {
		$this->_name =   'content';
		
		$this->primary= $this->_primary='content_id';	
		
		
		
		parent::__construct();
	}
	
	
/*
	 *   get  data list
	 */
	function getModelList($where=array(),$order=array(),$limit=array(),$model_table='') {
	    
		$select=$this->_db->select();
		$select->from($this->_name,"*");
				
		
		
		$select->join($model_table, $this->db_prefix."content.content_id={$model_table}.content_id", "*")	;
		
	    foreach((array)$where as $k=>$v){
	        if(is_int($v) || is_float($v)){
	           $select->where("$k =  ?",$v ) ; 
	        }else{
	           $select->where("$k like  ?",$v ) ;
	        }
	    }
	    if($order){
	       $select->order(array(" {$order['sort']} {$order['dir']} ")) ;  
	    }
		if($limit){
		    $select->limitPage($limit['start'],$limit['limit']) ;
		} 
      		  
	   $rs=$this->_db->fetchAll($select);
	  // $rs[0]['sub_table']='gg';
	   
	   return $rs;	
	}
	
	

	function getSame($arr) {	
		$ret=array();
		
		return parent::getSame(array("content_id"=>$arr['content_id']));
		
	}
	
	

}
